#ifndef BANGOAGENT_H
#define BANGOAGENT_H

#include "BangoNokiaQTLibrary_global.h"
#include "BangoFieldNames.h"
#include "BangoConstants.h"
#include "BangoSessionEvents.h"
#include "BangoStatic.h"
#include "BangoNameValuePair.h"
#include "BangoProfile.h"
#include "BangoEvent.h"
#include "BangoLogger.h"
#include "BangoPoster.h"

class BANGONOKIAQTLIBRARYSHARED_EXPORT BangoAgent : public QObject
{
    Q_OBJECT

public:
    static BangoProfile Profile();
    static QVector<BangoEvent*> Events();
    static void UserAgent(QString userAgent);

    static void setApplicationChannel(QString applicationChannel);
    static QString getApplicationChannel();
    static void setApplicationType(QString applicationType);
    static QString getApplicationType();
    static void setApplicationVersion(QString applicationVersion);
    static QString getApplicationVersion();
    static void setContinueSessionSeconds(int continueSessionSeconds);
    static int getContinueSessionSeconds();
    static void setFindLocation(bool findLocation);
    static bool getFindLocation();
    static void setLogEnabled(bool logEvents);
    static bool getLogEnabled();
    static void setPostURL(QString postURL);
    static QString getPostURL();
    static void setUseOfflineStorage(bool useOfflineStorage);
    static bool getUseOfflineStorage();
    static void setUserId(QString userId);
    static QString getUserId();

    static void onStartSession(QString applicationKey, QString eventValue, QString eventDetail, QMap<QString, QString> eventParameters);
    static void onStartSession(QString applicationKey, QMap<QString, QString> eventParameters);
    static void onStartSession(QString applicationKey, QString eventValue, QString eventDetail);
    static void onStartSession(QString applicationKey);
    static void onEndSession(bool forceEventPosting, QString eventValue, QString eventDetail, QMap<QString, QString> eventParameters);
    static void onEndSession(bool forceEventPosting, QMap<QString, QString> eventParameters);
    static void onEndSession(bool forceEventPosting, QString eventValue, QString eventDetail);
    static void onEndSession(bool forceEventPosting);
    static void onEndSession();
    static void onEvent(QString eventName, QString eventValue, QString eventDetail, QMap<QString, QString> eventParameters);
    static void onEvent(QString eventName, QString eventValue, QMap<QString, QString> eventParameters);
    static void onEvent(QString eventName, QString eventValue, QString eventDetail);
    static void onEvent(QString eventName, QString eventValue);
    static void onEvent(QString eventName);
    static void onDemandVideoStart(QString eventValue, QString eventDetail, QMap<QString, QString> eventParameters);
    static void onDemandVideoStart(QString eventValue, QString eventDetail);
    static void onDemandVideoStart(QString eventValue, QMap<QString, QString> eventParameters);
    static void onDemandVideoStart(QString eventValue);
    static void onDemandVideoStart();
    static void onDemandVideoStop(QString eventValue, QString eventDetail, QMap<QString, QString> eventParameters);
    static void onDemandVideoStop(QString eventValue, QString eventDetail);
    static void onDemandVideoStop(QString eventValue, QMap<QString, QString> eventParameters);
    static void onDemandVideoStop(QString eventValue);
    static void onDemandVideoStop();
    static void onLiveVideoStart(QString eventValue, QString eventDetail, QMap<QString, QString> eventParameters);
    static void onLiveVideoStart(QString eventValue, QString eventDetail);
    static void onLiveVideoStart(QString eventValue, QMap<QString, QString> eventParameters);
    static void onLiveVideoStart(QString eventValue);
    static void onLiveVideoStart();
    static void onLiveVideoStop(QString eventValue, QString eventDetail, QMap<QString, QString> eventParameters);
    static void onLiveVideoStop(QString eventValue, QString eventDetail);
    static void onLiveVideoStop(QString eventValue, QMap<QString, QString> eventParameters);
    static void onLiveVideoStop(QString eventValue);
    static void onLiveVideoStop();
    static void onIdle(QString eventValue, QString eventDetail, QMap<QString, QString> eventParameters);
    static void onIdle(QString eventValue, QString eventDetail);
    static void onIdle(QString eventValue, QMap<QString, QString> eventParameters);
    static void onIdle(QString eventValue);
    static void onIdle();
    static void onResume(QString eventValue, QString eventDetail, QMap<QString, QString> eventParameters);
    static void onResume(QString eventValue, QString eventDetail);
    static void onResume(QString eventValue, QMap<QString, QString> eventParameters);
    static void onResume(QString eventValue);
    static void onResume();
    static void onSearch(QString eventValue, QString eventDetail, QMap<QString, QString> eventParameters);
    static void onSearch(QString eventValue, QString eventDetail);
    static void onSearch(QString eventValue, QMap<QString, QString> eventParameters);
    static void onSearch(QString eventValue);
    static void onSearch();
    static void onPageView(QString eventValue, QString eventDetail, QMap<QString, QString> eventParameters);
    static void onPageView(QString eventValue, QString eventDetail);
    static void onPageView(QString eventValue, QMap<QString, QString> eventParameters);
    static void onPageView(QString eventValue);
    static void onPageView();
    static void onError(QString errorId, QString message, QString errorClass, QMap<QString, QString> errorParameters);
    static void onError(QString errorId, QString message, QString errorClass);
    static void onError(QString errorId, QMap<QString, QString> errorParameters);
    static void onError(QString errorId);
    static void onError();

    static void PostEvents();

    static QString ViewBatch();

private:
    static void PostStoredEventsNow();
    static BangoLogger _bangoLogger;
    static void startSession(QString applicationKey, QString eventValue, QString eventDetail, QMap<QString, QString> eventParameters);
    static void endSession(bool forceEventPosting, QString eventValue, QString eventDetail, QMap<QString, QString> eventParameters);
    static void PostEventsNow(bool postCurrent, bool useThread);
};

#endif //BANGOAGENT_H
